<?php
class NavCheck extends Check {

    public function addCheck(Model &$model,Array $condition) {
        if(self::isNullString($_POST['name'])) {
            $this->flag = false;
            $this->message[] = '导航名称不能为空!';
        }
        if(self::checkStrLength($_POST['name'],2,'min')) {
            $this->flag = false;
            $this->message[] = '导航条名称不能少于两位!';
        }
        if(self::checkStrLength($_POST['name'],5,'max')) {
            $this->flag = false;
            $this->message[] = '导航条名称不能大于五位!';
        }
        if($model->isOne($condition)) {
            $this->flag = false;
            $this->message[] = '导航名称已被占用!';
        }
        if(self::checkStrLength($_POST['info'],200,'max')) {
            $this->flag = false;
            $this->message[] = '导航条简介不能大于两百位!';
        }
        return $this->flag;
    }

    public function updateCheck(Model &$model) {
        if(self::checkStrLength($_POST['info'],200,'max')) {
            $this->flag = false;
            $this->message[] = '导航条简介不能大于两百位!';
        }
        return $this->flag;
    }

    public function checkNavName(Model &$model,Array $condition) {
        echo $model->isOne($condition) ? 1 : 2;
    }



}


?>